package com.hzncc.scaffold.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hzncc.scaffold.entity.Bo.ExpertapplyBo;
import com.hzncc.scaffold.entity.Other.Expertapply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 专家申请表 Mapper 接口
 * </p>
 *
 * @author DrunkBear
 * @since 2022-04-27
 */
@Component
public interface ExpertapplyMapper extends BaseMapper<Expertapply> {


    @Select("SELECT\n" +
            "\texpertapply.*,\n" +
            "\tuser.realname \n" +
            "FROM\n" +
            "\t`expertapply`\n" +
            "\tLEFT JOIN `user` ON user.id = expertapply.userId ${ew.customSqlSegment}")
    public List<ExpertapplyBo> listBo(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);


    @Select("SELECT\n" +
            "\t`id`,\n" +
            "\t`userId`,\n" +
            "\t`status`,\n" +
            "\t`publisherId`,\n" +
            "\t`content`,\n" +
            "\t`document`,\n" +
            "\t`createTime` \n" +
            "FROM\n" +
            "\t`expertapply` AS `expertapply` ${ew.customSqlSegment}")
    public Expertapply checkExpertApplied(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
}
